#include "mainwindowimpl.h"
#include "Character.h"
//
MainWindowImpl::MainWindowImpl( QWidget * parent, Qt::WFlags f) 
	: QMainWindow(parent, f)
{
	setupUi(this);
	
	connect(loadCharButton, SIGNAL(pressed()), this, SLOT(downloadChar()));
	connect(recalcStatsButton, SIGNAL(pressed()), &character, SLOT(recalcStats()));
	connect(&character, SIGNAL(statsUpdated()), this, SLOT(updateStats()));
	serverNameEdit->setText("Al'Akir");
	charNameEdit->setText("Hohounknown");
}
//

void MainWindowImpl::downloadChar(){
	character.setName(charNameEdit->text());
	character.setServer(serverNameEdit->text());
	character.download();
}
void MainWindowImpl::updateStats(){
	QString str;
	str+="Intellect: "+QString::number(character.intellect)+"\n";
	str+="Stamina: "+QString::number(character.stamina)+"\n";
	str+="Spirit: "+QString::number(character.spirit)+"\n";
	str+="spellhaste: "+QString::number(character.spellhaste)+"\n";
	str+="spellcrit: "+QString::number(character.spellcrit)+"\n";
	str+="spellhitrating: "+QString::number(character.spellhitrating)+"\n";
	textEdit->setText(str);
}
